# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=waybackurls
pkgver=13.8d27cf3
pkgrel=1
pkgdesc='Fetch all the URLs that the Wayback Machine knows about for a domain.'
arch=('x86_64' 'aarch64')
groups=('blackarch' 'blackarch-recon')
url='https://github.com/tomnomnom/waybackurls'
license=('MIT')
makedepends=('git' 'go')
source=("git+https://github.com/tomnomnom/$pkgname.git"
        'https://raw.githubusercontent.com/tomnomnom/gron/master/LICENSE')
sha512sums=('SKIP'
            '08f63749a84131c08a1174ed0604ce00e506d737ebdca616390c481de06c404460d5fab30bb7fc6e08c41bc76a3d949321272c5305580065534cbceb3207080c')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd $pkgname

  GOPATH="$srcdir" go mod init go.mod
  GOPATH="$srcdir" go mod tidy
  GOPATH="$srcdir" go mod download
  GOPATH="$srcdir" go build \
    -trimpath \
    -buildmode=pie \
    -mod=readonly \
    -modcacherw \
    -ldflags "-s -w" \
    -o $pkgname .
}

package() {
  cd $pkgname

  install -Dm 755 $pkgname "$pkgdir/usr/bin/$pkgname"
  install -Dm 644 README.mkd "$pkgdir/usr/share/doc/$pkgname/README.md"
}

